package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.MirrorAppDao;
import com.xbongbong.admin.domain.entity.MirrorAppEntity;
import com.xbongbong.admin.model.MirrorAppModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 镜像应用配置
 * @author xingxing.xiao
 * @date 2020/01/09 16:01
 */
@Service("mirrorAppModel")
public class MirrorAppModelImpl implements MirrorAppModel {

    @Resource
    private MirrorAppDao mirrorAppDao;

    @Override
    public Integer insert(MirrorAppEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return mirrorAppDao.insert(entity);
    }

    @Override
    public Integer update(MirrorAppEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return mirrorAppDao.update(entity);
    }

    @Override
    public List<MirrorAppEntity> findEntitys(Map<String, Object> param) {
        return mirrorAppDao.findEntitys(param);
    }

    @Override
    public MirrorAppEntity getByMirrorId(Long mirrorId) {
        return mirrorAppDao.getByMirrorId(mirrorId);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return mirrorAppDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
